package com.example.entity;

import jakarta.persistence.*;

import java.util.Objects;

@Entity
public class User
{
    public User(String username, String password, String usersex, String Cellphone) {
        this.username = username;
        this.password = password;
        this.usersex = usersex;
        this.Cellphone = Cellphone;
    }

    @Basic
    @Column(name = "username")
    private String username;

    @Basic
    @Column(name = "password")
    private String password;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "Uid")
    private int uid;
    @Basic
    @Column(name = "usersex")
    private String usersex;
    @Basic
    @Column(name = "Cellphone")
    private String Cellphone;

    public User() {

    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public String getUsersex() {
        return usersex;
    }

    public void setUsersex(String usersex) {
        this.usersex = usersex;
    }

    public String getCellphone() {
        return Cellphone;
    }

    public void setCellphone(String cellphone) {
        this.Cellphone = cellphone;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return uid == user.uid && Objects.equals(username, user.username) && Objects.equals(password, user.password) && Objects.equals(usersex, user.usersex) && Objects.equals(Cellphone, user.Cellphone);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, password, usersex, Cellphone);
    }
}
